<table class="table table-bordered" id="process-lists" data-toggle="datagrid" data-options="{
    tableWidth: '100%',
    height: '100%',
    gridTitle : '工序列表',
    showToolbar: true,
    toolbarItem: 'add,del',
    local: 'local',
    data: {{$lists}},
    paging: {pageSize:50, pageCurrent:5},
    linenumberAll: false,
    showLinenumber: false,
    showCheckboxcol: true,
    filterThead: false,
    showEditbtnscol: '操作',
    editUrl: '/admin/process/permission-edit?process_id={{$process_id}}',
    editCallback:processlists_editCallback,
    delUrl:'/admin/company/permission-delete',
    delPK:'id',
    delConfirm: true,
}">
    <thead>
    <tr>
        <th data-options="{name:'title',align:'center'}">工序权限名称</th>
        <th data-options="{name:'type_action',type:'select',items:{{$action_json}},align:'center'}">动作名称</th>
    </tr>
    </thead>
</table>
<script type="text/javascript">

    function processlists_editCallback( json ){
        BJUI.navtab('reload');
    }
    function action_manage(value, data)
    {
        var html      = '<button type="button" class="btn btn-info" data-toggle="navtab" data-options="';
            html      += '{id:\'process-permission-edit-navtab\',title:\''+data.title+'动作管理\',fresh:true,';
            html      += 'url:\'/admin/process/permission-edit\',data:{id:' + data.id + '}}';
            html      += '">设置</button>';
        return html
    }
    function field_manage(value, data)
    {
        var field_html      = '<button type="button" class="btn btn-info" data-toggle="navtab" data-options="';
        field_html      += '{id:\'process-field-edit-navtab\',title:\'字段分配\',fresh:true,';
        field_html      += 'url:\'/admin/process/field-edit\',data:{id:' + data.id + '}}';
        field_html      += '"> 字段分配</button>';
        var field_set_html  = '<button type="button" class="btn btn-info" data-toggle="navtab" data-options="';
        field_set_html  += '{id:\'process-field-manage-navtab\',title:\'字段设置\',fresh:true,';
        field_set_html  += 'url:\'/admin/process/field-manage\',data:{id:' + data.id + '}}';
        field_set_html  += '"> 字段管理</button>';
        var process_html    = '<button type="button" class="btn btn-info" data-toggle="navtab" data-options="';
        process_html    += '{id:\'process-process-edit-navtab\',title:\'工序分配\',fresh:true,';
        process_html    += 'url:\'/admin/process/process-edit\',data:{id:' + data.id + '}}';
        process_html    += '"> 工序分配</button>';
        var html            = '';
        var is_last         = data.is_last;
        if( is_last == 1 ){
            html            = field_html + field_set_html;
        } else if( is_last == 2 ){
            html            = process_html;
        } else {
            html            = field_html + process_html;
        }
        return html
    }
</script>